//
//  DlnaKeyboardEventData.m
//  MultiScreens
//
//  Created by apple on 15-1-12.
//  Copyright (c) 2015年 skyworth.digital. All rights reserved.
//

#import "DlnaKeyboardEventData.h"
#import <UIKit/UIKit.h>
static NSString *title = @"KEYBOARD_EVENT";
static  NSString *keyCodeTitle = @"KEYCODE_EVENT";
static NSString *tstitle=@"TS_EVENT";
@implementation DlnaKeyboardEventData{

}


+(NSString*)getKeyboardInputData:(NSString *)inputString InpuntKeyType:(NSString *)inputType{
    NSString *split = @"\n\r";
    NSString *result = [NSString stringWithFormat:@"%@%@%@%@%@",title,split,inputString,split,inputType];
    return result;
}

+(NSString*)getKeyCodeEvent:(int)keyCode State:(int)state Time:(int)time{
    NSString *split = @"\n\r";
    NSString *result = [NSString stringWithFormat:@"%@%@%d%@%d%@%d",keyCodeTitle,split,time,split,keyCode,split,state];
    return result;
}
+(NSString*)getTouchEventWithPoint:(CGPoint)touchPoint ScreenBoundary:(CGRect)rect fingerNum:(NSInteger)num ScreenSize:(CGSize)size{
    NSString *split = @"\n\r";
    NSInteger eventTime =0;  //一些无效参数，只为生成固定的格式的字符串。。。。
    NSInteger mask = 0;
    NSInteger index = 0;
    
    
    NSInteger x = touchPoint.x * rect.size.width/size.width;  //将手机屏幕的坐标转换成盒子屏幕的坐标。。
    NSInteger y = touchPoint.y * rect.size.height/size.height;
    
    NSString *tsEvent = [NSString stringWithFormat:@"%@%@%ld%@%ld%@%ld%@%ld%@%ld%@%ld",tstitle,split,(long)eventTime,split,(long)mask,split,(long)index,split,(long)num,split,(long)x,split,(long)y];
    
    NSLog(@"tsevent = %@",tsEvent);
    return tsEvent;
}
@end
